package handler

import (
    "context"
    "github.com/gin-gonic/gin"
    "gonaio_base/rpc/proto_user"
)

func UserReg(c *gin.Context) {
    userService := GetUserService()
    username := c.Query("username")
    password := c.Query("password")
    request := &proto_user.UserRegRequest{
        Username: username,
        Password: password,
    }
    response, _ := userService.Reg(context.TODO(), request)
    c.JSON(200, response)
}

func UserList(c *gin.Context) {
    userService := GetUserService()
    request := &proto_user.UserListRequest{
        Page:  1,
        Limit: 10,
    }
    response, _ := userService.List(context.TODO(), request)
    c.JSON(200, response.GetList())
}
